#include<iostream>
#include<string>
#define N 10
using namespace std;
struct Student{
  string name;
  //满分100；
  int math,chinese,english;
}grade[N]={
    {"Jack",60,86,78},{"Rose",70,65,71},{"Jhon",80,47,26},{"Jackie",90,98,48},{"Henrry",50,84,99},
    //5
    {"Andrew",65,82,88},{"Japenus",54,96,77},{"Lucy",87,98,92},{"Stevin",76,69,95},{"Ganlyee",79,87,91},
};
void swapFun(int &a,int &b);
void totalScore(){
    int arr[]={};
    for(int i=0;i<N;i++){
        arr[i]=grade[i].math+grade[i].chinese+grade[i].english;
    }
    cout<<"总成绩分别是："<<"\n"<<endl;
    for(int j=0;j<N;j++){
        cout<<"学生"<<grade[j].name<<"的总成绩为："<<arr[j]<<"\n"<<endl;
    }
    //冒泡排序
    for(int s=0;s<N-1;s++){
        for(int m=0;m<N-s-1;m++){
            if(arr[m]>arr[m+1]){
                swapFun(arr[m],arr[m+1]);
            }
        }
    }
    cout<<"总分最高是"<<arr[N-1]<<"\n"<<endl;
    cout<<"总分最低是"<<arr[0]<<"\n"<<endl;
}
void avgPoint(){
    int sum_math,sum_chinese,sum_english;
    for(int k=0;k<N;k++){
        sum_math+=grade[k].math;
        sum_chinese+=grade[k].chinese;
        sum_english+=grade[k].english;
    }
    cout<<"数学平均分为:"<<sum_math/N<<endl;
    cout<<"语文平均分为:"<<sum_chinese/N<<endl;
    cout<<"英语平均分为:"<<sum_english/N<<endl;
}
void swapFun(int &a,int &b){
    int tep=a;
    a=b;
    b=tep;
}
int main(){
    totalScore();
    avgPoint();
  return 0;
}
